package com.ytf.test.tenth;

/**
 * @author: YTF
 * @date: 2025/2/25 9:29
 * @version: 1.0
 * @description:
 */
public class Parcel9 {
    public Destination destination(final String dest){
        return new Destination() {
            private String label = dest;
            @Override
            public String readLabel() {
                return label;
            }
        };
    }

    public static void main(String[] args) {
        Parcel9 p = new Parcel9();
        Destination tasmania = p.destination("Tasmania");
        System.out.println(tasmania.readLabel());
        /**
         * OutPut
         * Tasmania
         * 总结：
         * 匿名内部类使用外部参数必须是final的
         */
    }
}
